#include <stdio.h>
#include <stdlib.h>
#include "sqlist.h"

/*

list = sqlist_creat();							//方式一
if( list == NULL)	
{
    fprintf(stderr,"sqlist_creat() Fail!\n");	


}
//通过二级指针进行传参

sqlist_creat1(&list);

*/


int main ()
{
	datetype arr [] = {12,23,34,45,56};	
	int err;
	sqlist *list = NULL;	

	list = sqlist_creat();							//方式二
	if( list == NULL)	
	{
		fprintf(stderr,"sqlist_creat() Fail!\n");	

	}
	
	for (int i = 0; i < (sizeof (arr) / sizeof (*arr));i++)
	{
		err= sqlist_add(list,0,&arr[i]);

	}

	if(	err != 0)
	{
		if(err == -1)
			fprintf(stderr, "arr is Full\n" );	
		else if(err == -2)
			fprintf(stderr, "arr is wrong" );
		else 
			fprintf (stderr, "Other Error!" );
		exit(1);
	}
	
	sqlist_display(list);	
	
	sqlist_delete(list,2);

	sqlist_display(list);	
	exit (0);
}
